package com.xinqi.modules.chat.sysmessage.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xinqi.common.mybatis.data.service.impl.BaseServiceImpl;
import com.xinqi.modules.chat.sysmessage.domain.SysRongYunUserEntity;
import com.xinqi.modules.chat.sysmessage.manager.SysRongYunUserManager;
import com.xinqi.modules.chat.sysmessage.mapper.SysRongYunUserMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 系统融云用户发消息Manager层
 * @author: dzy
 * @date: 2023/03/23
 */
@Service
public class SysRongYunUserManagerImpl extends BaseServiceImpl<SysRongYunUserMapper, SysRongYunUserEntity> implements SysRongYunUserManager {


    @Override
    public boolean insert(SysRongYunUserEntity entity) {
        return this.save(entity);
    }

    @Override
    public boolean insertBatch(List<SysRongYunUserEntity> list) {
        return this.saveBatch(list);
    }

    @Override
    public SysRongYunUserEntity getMaxId() {
        LambdaQueryWrapper<SysRongYunUserEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByDesc(SysRongYunUserEntity::getId).last("limit 1");
        return this.baseMapper.selectOne(wrapper);
    }
}
